package com.travel.controller;

import com.qianfeng.util.ResultMsg;
import com.travel.entity.TbHome;
import com.travel.entity.TbUser;
import com.travel.service.HomeOrderService;
import com.travel.service.HomeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/homeOrder")
public class FontHomeOrderController {

    @Autowired
    HomeOrderService homeOrderService;

    /**
     * 添加酒店入住订单(前端传对象)
     * */
    @GetMapping("/addOrderClass")
    public ResultMsg addOrderClass(TbUser user, TbHome home){
        return homeOrderService.addOrderClass(user,home);
    }

    /**
     * 添加酒店入住订单(前端传ID)
     * */
    @GetMapping("/addOrder")
    public ResultMsg addOrder(Integer userId, Integer homeId){
        return homeOrderService.addOrder(userId,homeId);
    }


    /**
     * 查询某人酒店入住订单
     * */
    @GetMapping("/getByUid")
    public ResultMsg getByUid(Integer userId){
        return homeOrderService.getByUid(userId);
    }

    /**
     * 根据订单号查询入住订单
     * */
    @GetMapping("/getByOid")
    public ResultMsg getByOid(String homeOrderId){
        return homeOrderService.getByOid(homeOrderId);
    }

    /**
     * 酒店入住订单,支付
     * */
    @GetMapping("/homeOrderPay")
    public ResultMsg homeOrderPay(String homeOrderId){
        return homeOrderService.homeOrderPay(homeOrderId);
    }

}
